package com.lakeworks.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;

import static java.util.Arrays.stream;

@Getter
@AllArgsConstructor
public enum ShipMentType {

    PENDING("1", "等待中"),

    ORDERING("2", "物流下单"),

    TOPICK("3", "待拣货"),

    PICKING("4", "拣货中"),

    PICKED("5", "已拣货"),

    PACKING("6", "装箱中"),

    PACKED("7", "已装箱"),

    SHIPPED("8", "已出厂");

    private final String value;

    private final String name;

    private static final HashMap<String, ShipMentType> map = new HashMap<>(16);

    static {
        stream(values()).forEach(shipMentType -> map.put(shipMentType.value, shipMentType));
    }

    public static ShipMentType instance(String value) {
        if (!map.containsKey(value))
            throw new RuntimeException("value不存在");
        return map.get(value);
    }

}
